package cn.wolfcode.edu.query;


import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.Formatter;
import cn.wolfcode.edu.util.DateUtil;
import org.springframework.util.StringUtils;

/**
 * Created by abb on 2018-07-09.
 */
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeQueryObject extends QueryObject{
    private String keyword;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date beginDate;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date endDate;
    private Long deptId;
    public String getKeyword() {
        return StringUtils.hasLength(keyword)? keyword.trim(): null ;
    }
    public Date getEndDate(){
        return endDate != null ? cn.wolfcode.edu.util.DateUtil.getEndDate(endDate):null;
    }




}
